export default {
  data(){
    return {
      search_form:{
        current: 1,
      },
      fixed_params:{},
      api: '',
      list_data:{
        list:[],
        current: 0,
        size: 10,
        total: 0,
      },
    }
  },
  onPullDownRefresh() {
		this.getList('refresh');
		setTimeout(function () {
			uni.stopPullDownRefresh();
		}, 1000);
	},
	onReachBottom(){
		this.getList();
	},
  methods:{
    getList(type){
      if(type == 'refresh'){  
        this.search_form.current = 1;
        this.list_data.list = [];
      }else{
        if(this.list_data.total > this.list_data.list.length){
          this.search_form.current ++;          
        }else{
          uni.showToast({title:'没有更多了',icon: 'none'});
          return;
        }
      }
      let opt = Object.assign({}, this.search_form, this.fixed_params);
      let params = this.$utils.getParam(opt);
      this.$http('get', this.api, params ,(data,msg) => {
        this.list_data.list = this.list_data.list.concat(data.records);
        this.list_data.current = data.current;
        this.list_data.size = data.size;
        this.list_data.total = data.total;
        this.getListCallback()
      })
    },
    getListCallback(){
      
    }
  }
}